package com.tjetc.utils;

import java.util.List;

public class PageInfo<T> {
    private int currentPage;
    private int count;
    private int pageSize;
    private int pages;
    private int prePage;
    private int nextPage;
    private int startRecord;

    public PageInfo(int currentPage, int count, int pageSize) {
        this.currentPage = currentPage;
        this.count = count;
        this.pageSize = pageSize;

        this.pages = count%pageSize == 0 ? count/pageSize : count/pageSize+1;
        this.prePage = currentPage == 1 ? 1 : currentPage-1;
        this.nextPage = currentPage==pages ? pages : currentPage+1;
        this.startRecord = (currentPage-1)*pageSize;
    }

    private List<T> list;

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public int getCount() {
        return count;
    }

    public int getPageSize() {
        return pageSize;
    }

    public int getPages() {
        return pages;
    }

    public int getPrePage() {
        return prePage;
    }

    public int getNextPage() {
        return nextPage;
    }

    public int getStartRecord() {
        return startRecord;
    }
}
